package p400;

import java.util.Arrays;
import java.util.Comparator;
import java.util.stream.Collectors;

/**
 * Definition for singly-linked list.
 **/

public class Leetcode_485 {
    public int findMaxConsecutiveOnes(int[] nums) {
        return Arrays.stream(Arrays.stream(nums).boxed().map(Object::toString).collect(Collectors.joining()).split("0")).max(Comparator.comparingInt(String::length)).map(String::length).orElse(0);
    }

    public static void main(String[] args) {
        Leetcode_485 l = new Leetcode_485();
        System.out.println(l.findMaxConsecutiveOnes(new int[]{1,1,0,1,1,1,1}));
    }
}
